package cn.edu.cdu.farmdeal.mapper;

import cn.edu.cdu.farmdeal.domain.Address;
import cn.edu.cdu.farmdeal.domain.Order;
import cn.edu.cdu.farmdeal.domain.OrderExample;

import java.math.BigInteger;
import java.util.List;
import java.util.Map;

import cn.edu.cdu.farmdeal.utils.Page;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.springframework.stereotype.Repository;

@Repository
@Mapper

public interface OrderMapper {
    int getOrderNum(String username);

    int confirmReceipt(int id);

    int insertOrder(@Param("r") Order order);
    /**
     * 根据shopid获取订单
     *
     * @param user_id
     * @return List
     */
    List<Map<String, Object>> getOrderInfo(@Param("user_id") String user_id, @Param("page") Page page, @Param("order") Order order,
                                           @Param("address") Address address);
    /**
     * 获得该商店的所有订单
     *
     * @param  order user_id
     */
    int getTotalCount(@Param("user_id") String user_id, @Param("order") Order order,@Param("address") Address address);
    /**
     * 修改状态
     * @param orderNo
     * @return
     */
    int updateOrderStatusPay(int orderNo);
    /**
     * 获得所有的订单
     * @return
     */
    List<Order> getAllOrders();

    /**
     * 更新库存
     * @param buySum
     * @param
     * @return
     */
    int updateStock(@Param("id") int buySum,@Param("buySum") int buysum);
    int countByExample(OrderExample example);

    int deleteByExample(OrderExample example);

    int deleteByPrimaryKey(Integer id);

    int insert(Order record);

    int insertSelective(Order record);

    List<Order> selectByExample(OrderExample example);

    Order selectByPrimaryKey(Integer id);

    int updateByExampleSelective(@Param("record") Order record, @Param("example") OrderExample example);

    int updateByExample(@Param("record") Order record, @Param("example") OrderExample example);

    int updateByPrimaryKeySelective(Order record);

    int updateByPrimaryKey(Order record);
}